how to sort a dictionary by keys and by values ​​in python